home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE05 / RESOURCE / BIT3.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-07-12  |  1.2 KB  |  60 lines

  1. unit Bit3;
  2.  
  3. interface
  4.  
  5. {$R BITS.RES}
  6.  
  7. uses
  8.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  9.   Forms, Dialogs, ExtCtrls;
  10.  
  11. type
  12.   TForm1 = class(TForm)
  13.     Image1: TImage;
  14.     Timer1: TTimer;
  15.     procedure FormCreate(Sender: TObject);
  16.     procedure Timer1Timer(Sender: TObject);
  17.     procedure FormDestroy(Sender: TObject);
  18.   private
  19.     { Private declarations }
  20.   public
  21.     { Public declarations }
  22.     MyBitmap:array [0..1] of TBitmap;
  23.     BitMapNum:integer;
  24.   end;
  25.  
  26. var
  27.   Form1: TForm1;
  28.  
  29. implementation
  30.  
  31. {$R *.DFM}
  32.  
  33. procedure TForm1.FormCreate(Sender: TObject);
  34. begin
  35.     MyBitmap[0]:=TBitmap.Create;    
  36.     MyBitmap[1]:=TBitmap.Create;
  37.   MyBitmap[0].Handle := LoadBitmap(hInstance,'FIRST');
  38.   MyBitmap[1].Handle := LoadBitmap(hInstance,'SECOND');
  39.     Image1.Width:=MyBitmap[0].Width;
  40.   Image1.Height:=MyBitmap[0].Height;
  41.     { Show the image component copy of the bitmap }
  42.   Image1.Canvas.Draw(0,0,MyBitmap[0]);
  43.     BitMapNum:=0;
  44.   Timer1.Interval:=200;
  45. end;
  46.  
  47. procedure TForm1.Timer1Timer(Sender: TObject);
  48. begin
  49.   BitMapNum:= (BitMapNum + 1) MOD 2;
  50.   Image1.Canvas.Draw(0,0,MyBitmap[BitMapNum]);
  51. end;
  52.  
  53. procedure TForm1.FormDestroy(Sender: TObject);
  54. begin
  55.     MyBitmap[0].Destroy;
  56.   MyBitmap[1].Destroy;
  57. end;
  58.  
  59. end.
  60.